package com.bnc.menu.notice;
import java.awt.*;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.JButton;

import com.bnc.manager.JDBCManager;

import java.awt.event.*;
import java.sql.*;


public class boardtest extends Frame implements MouseListener{

	private JFrame frame;
	private JTable table_1;
	private JDBCManager jdbcManager;
	private PreparedStatement pstmt;
	private ResultSet rs;


	/**
	 * Launch the application.
	 */
//	public static void main(String[] args) {
//		EventQueue.invokeLater(new Runnable() {
//			public void run() {
//				try {
//					boardtest window = new boardtest();
//					window.frame.setVisible(true);
//				} catch (Exception e) {
//					e.printStackTrace();
//				}
//			}
//		});
//	}

	/**
	 * Create the application.
	 */
	private void resultSelect()
	{
//		try
//		{
//			String query = "SELECT * FROM TBL_NOTICE";
//			
//			pstmt = jdbcManager.prepareStatement( query );
//			rs = pstmt.executeQuery();
//			
//			while ( rs.next() )
//			{
//				textarea.add(NoticeDTO( rs ) );
//			}
//		} 
//		catch ( SQLException e )
//		{
//			e.printStackTrace();
//		}
//		finally
//		{
//			close();
//		}
//		
//		print();
	}
	
	private Component NoticeDTO(ResultSet rs2) {
		// TODO Auto-generated method stub
		return null;
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 638, 508);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().setLayout(null);
		
		JLabel Label_1 = new JLabel("\uACF5 \uC9C0 \uC0AC \uD56D");
		Label_1.setBounds(12, 10, 149, 23);
		frame.getContentPane().add(Label_1);
		
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBounds(12, 43, 591, 379);
		frame.getContentPane().add(scrollPane);
		
		table_1 = new JTable();
		table_1.setModel(new DefaultTableModel(
			new Object[][] {
				{null, null, null, null},
				{null, null, null, null},
				{null, null, null, null},
				{null, null, null, null},
				{null, null, null, null},
				{null, "", null, null},
				{null, null, null, null},
				{null, null, null, null},
				{null, "", null, null},
				{null, null, null, null},
				{null, null, null, null},
				{null, null, null, null},
				{null, null, null, null},
				{null, null, null, null},
				{null, null, null, null},
				{null, null, null, null},
				{null, null, null, null},
				{null, null, null, null},
				{null, null, null, null},
				{null, null, null, null},
			},
			new String[] {
				"no", "\uB0B4 \uC6A9", "\uC791 \uC131 \uC77C", "\uC791 \uC131 \uC790"
			}
		) {
			boolean[] columnEditables = new boolean[] {
				false, false, false, false
			};
			public boolean isCellEditable(int row, int column) {
				return columnEditables[column];
			}
		});
		table_1.getColumnModel().getColumn(0).setResizable(false);
		table_1.getColumnModel().getColumn(0).setPreferredWidth(40);
		table_1.getColumnModel().getColumn(0).setMinWidth(5);
		table_1.getColumnModel().getColumn(1).setPreferredWidth(310);
		table_1.getColumnModel().getColumn(2).setResizable(false);
		table_1.getColumnModel().getColumn(2).setPreferredWidth(67);
		table_1.getColumnModel().getColumn(3).setResizable(false);
		table_1.getColumnModel().getColumn(3).setPreferredWidth(65);
		table_1.addMouseListener(this);
		scrollPane.setViewportView(table_1);
		
		
		
		JButton btn_1 = new JButton("\uB4F1 \uB85D");
		btn_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Noticewrite nw = new Noticewrite();
				nw.setVisible(true);
			}
		});
		btn_1.setBounds(397, 441, 97, 23);
		frame.getContentPane().add(btn_1);
		
		JButton btn_3 = new JButton("\uC0AD \uC81C");
		btn_3.setBounds(506, 441, 97, 23);
		frame.getContentPane().add(btn_3);
	}

	@Override
	public void mouseClicked(MouseEvent e) {
		if(e.getClickCount() ==2){
			Noticewrite nw = new Noticewrite();
			nw.setVisible(true);
		}
		
	}

	@Override
	public void mousePressed(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseEntered(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}
}
